package cn.sylinx.horm.spring.boot;

import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;
import org.springframework.lang.NonNull;

class SqlClientUseNativeCondition implements Condition {
    @Override
    public boolean matches(@NonNull ConditionContext context, @NonNull AnnotatedTypeMetadata metadata) {
        String type = context.getEnvironment().getProperty("horm.config.datasource.use-native", "false");
        String type1 = context.getEnvironment().getProperty("horm.config.datasource.useNative", "false");
        return Boolean.parseBoolean(type) || Boolean.parseBoolean(type1);
    }
}
